import { http } from '@/utils/http'
import type { BannerItem, CategoryItem, HotItem } from '@/types/home'
import type { PageParams, PageResult, GoodsItem } from '@/types/global'

/**
 * 首页 广告区域
 * @param distributionSite
 * @returns
 */
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite,
    },
  })
}

/**
 * 首页 前台分类
 * @returns
 */
export const getHomeCategoryAPI = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}

/**
 * 首页 热门推荐
 * @returns
 */
export const getHomeHotAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

/**
 * 首页 猜你喜欢
 * @returns
 */
export const getHomeGoodsGuessLikeAPI = (data: PageParams) => {
  return http<PageResult<GoodsItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}
